home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc™ Source Code / Utilities / TransUtl.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-28  |  1.7 KB  |  95 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        TransUtl.cp
  3.  
  4.     Contains:    Translation utilities.
  5.  
  6.     Owned by:    Caia Grisar
  7.  
  8.     Copyright:    © 1993 - 1995 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     
  11.     In Progress:
  12. */
  13.  
  14. #ifndef _TRANSUTL_
  15. #include <TransUtl.h>
  16. #endif
  17.  
  18. #ifndef _EXCEPT_
  19. #include <Except.h>
  20. #endif
  21.  
  22. #ifndef _TYPELIST_
  23. #include "TypeList.xh"
  24. #endif
  25.  
  26. #ifndef SOM_ODTypeListIterator_xh
  27. #include <TypLsItr.xh>
  28. #endif
  29.  
  30. #ifndef SOM_ODSession_xh
  31. #include <ODSessn.xh>
  32. #endif
  33.  
  34. #ifndef SOM_ODTranslation_xh
  35. #include <Translt.xh>
  36. #endif
  37.  
  38. #ifndef _BNDNSUTL_
  39. #include "BndNSUtl.h"
  40. #endif
  41.  
  42. #ifndef _EXCEPT_
  43. #include "Except.h"
  44. #endif
  45.  
  46. #ifndef _ORDCOLL_
  47. #include "OrdColl.h"
  48. #endif
  49.  
  50. #ifndef _TEMPITER_
  51. #include <TempIter.h>
  52. #endif
  53.  
  54. //------------------------------------------------------------------------------
  55. // GetDestinationKindsList
  56. //------------------------------------------------------------------------------
  57. void GetDestinationKindsList(
  58.         ODTypeList*    kindList,
  59.         ODTypeList*    translateToList,
  60.         OrderedCollection* translateFromList,
  61.         ODSession* session)
  62. {
  63.     Environment* ev = somGetGlobalEnvironment();
  64.  
  65.     ODType kind = kODNULL;
  66.     ODTranslation* translation = session->GetTranslation(ev);
  67.  
  68.     ODULong kindIndex = 0;
  69.  
  70.     for( TempODTypeListIterator kindIter(ev,kindList); kindIter; kindIter.Next() )
  71.     {
  72.         ODType kind = kindIter.Current();
  73.         ++kindIndex;
  74.  
  75.         TempODTypeList toList = translation->GetTranslationOf(ev, kind);
  76.         
  77.         for( TempODTypeListIterator toIter(ev,toList); toIter; toIter.Next() )
  78.         {
  79.             ODType toKind = toIter.Current();
  80.  
  81.             if ( (kindList->Contains(ev, toKind) == kODFalse)
  82.                 &&
  83.                  (translateToList->Contains(ev, toKind) == kODFalse)
  84.                )
  85.             {
  86.                 translateToList->AddLast(ev, toKind);
  87.                 if ( translateFromList )
  88.                     translateFromList->AddLast((void*) kindIndex);
  89.             }
  90.         }
  91.     }
  92. }
  93.  
  94.  
  95.